# RT-Thread building script for component

from building import *

cwd = GetCurrentDir()

# add the general drivers.
src = Split("""
board.c
""")

# add gpio driver code
if  GetDepend(['BSP_USING_GPIO']):
    src += ['drv_gpio.c']

# add serial driver code
if  GetDepend('BSP_USING_UART0') or GetDepend('BSP_USING_UART1') or GetDepend('BSP_USING_UART2') or GetDepend('BSP_USING_UART3'):
    src += ['drv_uart.c']

# add spi driver code
if  GetDepend('BSP_USING_SPI0') or GetDepend('BSP_USING_SPI1'):
    src += ['drv_spi.c']

# add i2c driver code
if  GetDepend(['BSP_USING_I2C']):
    src += ['drv_i2c.c']

# add sram driver code
if  GetDepend(['BSP_USING_EXT_SRAM']):
    src += ['drv_sram.c']

# add nor flash driver code
if  GetDepend(['BSP_USING_NOR_FLASH']):
    src += ['drv_nor_flash.c']

# add pwm driver code
if  GetDepend('BSP_USING_PWM0') or GetDepend('BSP_USING_PWM1') or GetDepend('BSP_USING_PWM2') or GetDepend('BSP_USING_PWM3'):
    src += ['drv_pwm.c']

# add rtc driver code
if GetDepend(['BSP_USING_RTC']):
    src += ['drv_rtc.c']

# add hwtimer driver code
if GetDepend(['BSP_USING_WDT']):
    src += ['drv_iwg.c']

# add hwtimer driver code
if  GetDepend('BSP_USING_HWTIMER0') or GetDepend('BSP_USING_HWTIMER1') or  GetDepend('BSP_USING_HWTIMER2') or GetDepend('BSP_USING_HWTIMER3') or GetDepend('BSP_USING_HWTIMER4') or GetDepend('BSP_USING_HWTIMER5'):
    src += ['drv_hwtimer.c']

CPPPATH = [cwd]

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
